#coding=utf8

import datetime

from former_project.models.common.models import Hotnews

def get_hotnews_info(key, keyvalue):
    '''获取Hotnews的基本信息'''
    if key:
        hotnews_data = Hotnews.fetch_objects("where %s=%%s" % key, (keyvalue,),
                                             source_result=True)
        if hotnews_data:
            return hotnews_data[0]
        else:
            return None
    else:
        hotnews_data = Hotnews.fetch_objects(source_result=True)
        return hotnews_data

if __name__ == "__main__":
    print get_hotnews_info('id',2)